home *** CD-ROM | disk | FTP | other *** search
/ Suzy B Software 2 / Suzy B Software CD-ROM 2 (1994).iso / extras / programm / gemfsc20 / gemfsc20.lzh / GEMFBIND / VSTRSTAK.S < prev    next >
Text File  |  1993-03-26  |  2KB  |  47 lines

  1. ;*========================================================================
  2. ;* VDIFAST Public Domain VDI bindings.
  3. ;*========================================================================
  4.  
  5.  
  6. ;*------------------------------------------------------------------------
  7. ;*-----------------------------------------------------------------------
  8. ;* vstr_stack.
  9. ;*
  10. ;*    For VDI text functions that need the string stacked into intin in
  11. ;*    ADE format.
  12. ;*
  13. ;*    This function is not exported to C, it is to be used only by vdi
  14. ;*    bindings routines.
  15. ;*
  16. ;*    Entry:    a0.l -> string
  17. ;*    Exit:    a0.l -> stacked integerized (ADE) string
  18. ;*            d0.w  = stack words used (intin count)
  19. ;*           d1,a1  = Trashed by this routine.
  20. ;*-----------------------------------------------------------------------
  21. ;*------------------------------------------------------------------------
  22.  
  23.           globl     vstr_stack
  24. vstr_stack:
  25.  
  26.           move.l    (sp)+,a1            ;* Save return address.
  27.           moveq.l    #0,d0                ;* Zero out string length counter.
  28. strcnt:                                 ;* Count up length of string...
  29.           tst.b     (a0)+                ;* Found end yet?
  30.           beq.b     strend                ;* Yep, go integerize it.
  31.           addq.w    #1,d0                ;* Nope, add 1 to counter,
  32.           bra.b     strcnt                ;* and keep looking.
  33. strend:
  34.           move.w    d0,d1                ;* Prime loop counter. Move count to
  35.           swap        d0                    ;* high order d0; use low order as work
  36. strcpy:                                 ;* area for zero-extending bytes.
  37.           move.b    -(a0),d0            ;* Copy with each string byte in the
  38.           move.w    d0,-(sp)            ;* low byte of each stack word,
  39.           dbra        d1,strcpy            ;* which is how VDI likes to see it.
  40.  
  41.           clr.w     d0                    ;* clear cruft out of low-order d0
  42.           swap        d0                    ;* swap to put count back in low order.
  43.           move.l    sp,a0                ;* Save pointer to stacked string.
  44.           jmp        (a1)                ;* Return to caller.
  45.  
  46.           end
  47.